package main

import (
	"os"
	"os/exec"

	"github.com/spf13/cobra"
)

// 执行获取物理磁盘列表命令
func runstorcliGetPdList(cmd *cobra.Command, args []string) error {
	toolPath, err := extractTool("tools/storcli64")
	if err != nil {
		return err
	}

	storcliCmd := exec.Command(toolPath, "/c0/eall/sall", "show", "all")

	storcliCmd.Stdin = os.Stdin
	storcliCmd.Stdout = os.Stdout
	storcliCmd.Stderr = os.Stderr

	return storcliCmd.Run()
}

// 执行获取逻辑磁盘列表命令
func runstorcliGetLdList(cmd *cobra.Command, args []string) error {
	toolPath, err := extractTool("tools/storcli64")
	if err != nil {
		return err
	}

	storcliCmd := exec.Command(toolPath, "/c0/vall", "show", "all")
	storcliCmd.Stdin = os.Stdin
	storcliCmd.Stdout = os.Stdout
	storcliCmd.Stderr = os.Stderr

	return storcliCmd.Run()
}
